package com.ldg.search.controller;

import com.ldg.search.entity.ItemVo;
import com.ldg.search.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Author: Liudao
 * @Date: 2022-09-22-14:51
 * @Description:
 */
@Controller
public class SearchController {
    @Autowired
    private ItemService itemService;

    @GetMapping({"/","/index.html"})
    public String search(Model model, ItemVo vo){
        Map<String, Object> resultMap = itemService.search(vo);
        model.addAttribute("resultMap",resultMap);
        model.addAttribute("vo",vo);
        return "search";
    }

}
